<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <title>computed计算函数</title>
</head>

<body>
    <table id="app">
        <tr>
            <td>生日</td>
            <td>{{getbirthday}}</td>

        </tr>
        <tr>
            <td>年龄</td>
            <td>{{age}}</td>
        </tr>
        <tr>
            <td>地址</td>
            <td>{{address}}</td>
        </tr>
    </table>
    <!-- <button type="button" onclick="app.age+=1;">加</button> -->
    <button type="button" onclick="a.age+=1;">加加</button>

    <script>
        var a = new Vue({
            el: '#app',
            data: {
                birthday: 914228510514,
                age: 19,
                address: '北京昌平区龙泽飞龙'
            },
            computed: {
                getbirthday: function() {
                    var m = new Date(this.birthday);

                    return m.getFullYear() + '年' + m.getMonth() + "月" + m.getDay() + '日';

                }
            }
        })
    </script>
</body>

</html>